//
//  SecondTableViewCell.m
//  AStage_shougongke
//
//  Created by 赵磊 on 16/1/21.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "SecondTableViewCell.h"

@implementation SecondTableViewCell
- (void)dealloc
{
    [_numberLabel release];
    [_nameLabel release];
    [_desLabel release];
    [_imgView release];
    [_priceLabel release];
    [_sumLabel release];
    [super dealloc];
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.nameLabel = [[UILabel alloc] init];
        [self.contentView addSubview:_nameLabel];
        self.numberLabel = [[UILabel alloc] init];
        _numberLabel.layer.cornerRadius = 10;
        _numberLabel.clipsToBounds = YES;
        _numberLabel.textAlignment = NSTextAlignmentCenter;
        _numberLabel.backgroundColor = [UIColor colorWithRed:234 / 255.0 green:86 / 255.0 blue:81 / 255.0 alpha:1.0];
        _numberLabel.textColor = [UIColor whiteColor];
        [self.contentView addSubview:_numberLabel];
        self.desLabel = [[UILabel alloc] init];
        _desLabel.numberOfLines = 0;
        [self.contentView addSubview:_desLabel];
        _desLabel.font = [UIFont systemFontOfSize:15];
        _desLabel.textColor = [UIColor lightGrayColor];
        self.imgView = [[UIImageView alloc] init];
        _imgView.backgroundColor = [UIColor yellowColor];
        [self.contentView addSubview:_imgView];
        self.priceLabel = [[UILabel alloc] init];
        _priceLabel.textColor = [UIColor colorWithRed:234 / 255.0 green:86 / 255.0 blue:81 / 255.0 alpha:1.0];
        [self.contentView addSubview:_priceLabel];
        self.sumLabel = [[UILabel alloc] init];
        _sumLabel.font = [UIFont systemFontOfSize:14];
        _sumLabel.textColor = [UIColor lightGrayColor];
        [self.contentView addSubview:_sumLabel];
    }
    return self;
}
- (void)layoutSubviews
{
    [super layoutSubviews];
    _numberLabel.frame = CGRectMake(10, 3, 20, 20);
    _nameLabel.frame = CGRectMake(40, 0, self.contentView.frame.size.width - 50, 30);
    // desLabel的高度
    CGFloat h = [HeightAdaption heightWithText:_desLabel.text Size:15 Width:self.contentView.frame.size.width - 20];
    _desLabel.frame = CGRectMake(10, 40, self.contentView.frame.size.width - 20, h);
    _imgView.frame = CGRectMake(10, 50 + h, self.contentView.frame.size.width - 20, (self.contentView.frame.size.width - 20) * self.scale);
    _priceLabel.frame = CGRectMake(10, 60 + h + (self.contentView.frame.size.width - 20) * self.scale, 100, 30);
    _sumLabel.frame = CGRectMake(110, 60 + h + (self.contentView.frame.size.width - 20) * self.scale, 100, 30);
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
